home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1975 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: noc.tor.hookup.net!news
  2. From: Rajendra_Singh@msn.com (Rajendra Singh)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Checking for a file => Does it exist (Help)
  5. Date: Thu, 18 Jan 1996 03:52:32 GMT
  6. Organization: HookUp Communication Corporation, Oakville, Ontario, CANADA
  7. Message-ID: <4dk545$dts@noc.tor.hookup.net>
  8. References: <4d9k6fINNnja@faatcrl.faa.gov> <4df2ej$pqr@news.infi.net>
  9. NNTP-Posting-Host: u36u400.tor.hookup.net
  10. NNTP-Posting-User: u36u400
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. nngis@norfolk.infi.net (Greg DiGiorgio) wrote:
  14.  
  15. >In article <4d9k6fINNnja@faatcrl.faa.gov>, afrawert@faatcrl.faa.gov 
  16. >says...
  17. >>
  18. >>
  19. >>
  20. >>                        I'm having a problem just checking to see if a 
  21. >file
  22. >>exists. Does anyone have a simple piece of code that I can use?
  23.  
  24. The "access()" function returns 0 if a file exists.  The following
  25. line would satisfy your need:
  26.  
  27. if (!access(fileName, F_OK))
  28.    puts("File exists!");
  29.  
  30.  
  31. ---
  32. Rajendra Singh, B. Sc. (Rajendra_Singh@msn.com)
  33. "What is understood need not be discussed." - Loren Adams
  34.  
  35.